﻿using AiFrame.InterfaceLib.Data.Access;
using AiFrame.InterfaceLib.Data.Provider;
using AiFrame.InterfaceLib.MVP;
using AiFrame.InterfaceLib.Plugins;
using AiFrame.InterfaceLib.Windows.Themes;
using AiFrame.InterfaceLib.Windows.UI;

namespace AiFrame.Base.Core.Plugins
{
    /// <summary>
    /// Diese Klasse wird an alle Plugins ausgeliefert, damit
    /// diese auf das Hauptprogramm zugreifen können.
    /// </summary>
    public class CoreInterface: ICoreInterface
    {
        private readonly IWindowManager<IWindow> _windowManager;
        private readonly INavigationBar _navigationBar;
        private readonly IStyleGuideUI _styleGuideUI;
        private readonly ITheme _theme;
        private readonly IMainMenu _mainMenu;
        private IToolBarManager _toolBarManager;

        public IDatabaseConnection DatabaseConnection
        {
            get { return Factories.ComponentFactory.DatabaseConnection; }
        }

        public IWindowManager<IWindow> WindowManager
        {
            get { return _windowManager; }
        }

        public IStyleGuideUI StyleGuideUI
        {
            get { return _styleGuideUI; }
        }

        public INavigationBar NavigationBar
        {
            get { return _navigationBar; }
        }

        public ITheme Theme
        {
            get { return _theme; }
        }

        public IDbProviderRegistration ProviderRegistration
        {
            get { return Factories.ComponentFactory.DbProviderRegistration; }
        }

        public IPluginManager PluginManager
        {
            get { return Factories.ComponentFactory.PluginManager; }
        }

        public IFactoryManager FactoryManager
        {
            get { return Factories.ComponentFactory.FactoryManager; }
        }

        public IToolBarManager ToolBarManager
        {
            get { return _toolBarManager; }
        }

        public IMainMenu MainMenu
        {
            get { return _mainMenu; }
        }

        public CoreInterface(IWindowManager<IWindow> windowManager, INavigationBar navigationBar,
                             IStyleGuideUI styleGuideUI, ITheme theme, IToolBarManager toolBarManager, 
                             IMainMenu mainMenu)
        {
            _windowManager = windowManager;
            _navigationBar = navigationBar;
            _styleGuideUI = styleGuideUI;
            _theme = theme;
            _toolBarManager = toolBarManager;
            _mainMenu = mainMenu;
        }
    }
}